home *** CD-ROM | disk | FTP | other *** search
- function showPrefs()
- {
- var front = document.getElementById("front");
- var back_w = document.getElementById("back");
- if (window.widget)
- widget.prepareForTransition("ToBack");
- front.style.display="none";
- back_w.style.display="block";
-
- if (window.widget)
- setTimeout('widget.performTransition();', 0);
- }
-
- function hidePrefs()
- {
- var front = document.getElementById("front");
- var back_w = document.getElementById("back");
- if (window.widget)
- widget.prepareForTransition("ToFront");
- back_w.style.display="none";
- front.style.display="block";
- if (window.widget)
- setTimeout ('widget.performTransition();', 0);
- savePrefs();
- }
-
- function savePrefs(){
- allowDupes = (document.getElementById("allowDupes").checked == 1);
- allowBlanks = (document.getElementById("allowBlanks").checked == 1);
- widget.setPreferenceForKey(allowBlanks, "allowBlanks");
- widget.setPreferenceForKey(allowDupes, "allowDupes");
- }
-
- function showInstructions(){
- document.getElementById("options").style.display = "none";
- document.getElementById("instructions").style.display = "block";
- }
-
- function hideInstructions(){
- document.getElementById("options").style.display = "block";
- document.getElementById("instructions").style.display = "none";
- }
-
- function updateStats(){
- var percent = (wins + losses == 0 ? "N/A" : (Math.round( (wins/(losses + wins)*100))) + "%");
- var average = (wins == 0 ? "N/A" : Math.round(guesses*100/wins)/100);
- document.getElementById("stats").innerHTML = "<b>Statistics: " +
- "<br/> Totals: " + wins + " wins " + losses + " losses" +
- "<br/> Percent games won: " + percent +
- "<br/> Average guesses to win: " + average + "</b>";
- }
-
- function clearStats(){
- widget.setPreferenceForKey(0, "wins");
- widget.setPreferenceForKey(0, "guesses");
- widget.setPreferenceForKey(0,"losses");
- wins = 0;
- losses = 0;
- guesses = 0;
- updateStats();
- }
-
-